﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" debug="true">
<head runat="server">
	<title>Console</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="MSThemeCompatible" content="Yes" />
	<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />

	<script type="text/javascript" src="Firebug/firebug.js"></script>
	<script type="text/javascript">
		window.c = window.console;
		window.host = GetObject("", "OSH.Host");
		window.browser = host.WebBrowser.ActiveXInstance;
		window.doc = browser.Document;
		window.win = doc.parentWindow;

		//**********************************************************
		// Adds command history to Firebug console.
		//**********************************************************
		function FirebugConsoleHistory()
		{
			var commands = [];
			var commandIndex = -1;
			var commandLine;

			this.initialize = function()
			{
				var doc;
				for(var i = 0; i < window.frames.length; i++)
				{
					if(window.frames[i].location.href.indexOf("firebug.html") != -1)
					{
						doc = window.frames[i].document;
						break;
					}
				}
				
				commandLine = doc.getElementById("commandLine");
				commandLine.attachEvent("onkeydown", onCommandLineKeyDown);
				commandLine.focus();
			}
			
			function moveUp(commandText)
			{
				if(commandIndex > 0)
					return commands[--commandIndex];

				return commandText;
			}

			function moveDown(commandText)
			{
				if(commandIndex < commands.length)
					return commands[++commandIndex] || "";

				return commandText;
			}

			function store(commandText)
			{
				for(var i = 0; i < commands.length; i++)
					if(commands[i] == commandText)
					{
						commands.splice(i, 1);
						break;
					}
				commands.push(commandText);
				commandIndex = commands.length;
			}

			function onCommandLineKeyDown(event)
			{
				if(event.keyCode == 13)
				{
					store(commandLine.value);
				}
				else if(event.keyCode == 38 && !event.shiftKey && event.ctrlKey) // up
				{
					commandLine.value = moveUp(commandLine.value);
					commandLine.focus();
					event.returnValue = false;
				}
				else if(event.keyCode == 40 && !event.shiftKey && event.ctrlKey) // down
				{
					commandLine.value = moveDown(commandLine.value);
					commandLine.focus();
					event.returnValue = false;
				}
				else if((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey && (event.metaKey || event.ctrlKey))
				{
					window.top.console.close();
					event.cancelBubble = true;
					event.returnValue = false;
				}
			}
		}
		FirebugConsoleHistory._current = new FirebugConsoleHistory();
		FirebugConsoleHistory.initialize = function() { FirebugConsoleHistory._current.initialize(); }

	</script>
	<style type="text/css">
		body { background-color: ThreeDFace; font-family: Lucida Grande, Tahoma, sans-serif; font-size: 12px; }
		h2 { font-size: 13px; font-weight: bold; margin: 0; }
		.var {}
		.obj { color: blue; }
		.comment { color: green; font-style: italic; }
		.shortcut {}
		.desc { color: green; }
		.command {}
		table.list { margin-left: 20px; }
	</style>
</head>
<body scroll="no" style="">

	<h2>Keyboard shortcuts</h2>
	<table class="list">
		<tr>
			<td class="shortcut">Ctrl+Shift+L</td>
			<td class="desc">- Hide/Show console frame</td>
		</tr>
		<tr>
			<td class="shortcut">Ctrl+Up</td>
			<td class="desc">- Previous command</td>
		</tr>
		<tr>
			<td class="shortcut">Ctrl+Down</td>
			<td class="desc">- Next command</td>
		</tr>
	</table>

	<h2>Variables</h2>
	<table class="list">
		<tr>
			<td class="var">window.c =</td>
			<td class="obj">window.console;</td>
			<td class="comment">// Firebug console object</td>
		</tr>
		<tr>
			<td class="var">window.host =</td>
			<td class="obj">GetObject("", "OSH.Host");</td>
			<td class="comment">// OSH Host object</td>
		</tr>
		<tr>
			<td class="var">window.browser =</td>
			<td class="obj">host.WebBrowser.ActiveXInstance;</td>
			<td class="comment">// OSH Web Browser Control</td>
		</tr>
		<tr>
			<td class="var">window.doc =</td>
			<td class="obj">browser.Document;</td>
			<td class="comment">// OSH HTML document object</td>
		</tr>
		<tr>
			<td class="var">window.win =</td>
			<td class="obj">doc.parentWindow;</td>
			<td class="comment">// OSH HTML top window object</td>
		</tr>
	</table>

	<h2>Commands</h2>
	<table class="list">
		<tr>
			<td class="command">console.dir(object)</td>
			<td class="desc">- Prints an interactive listing of all properties of the object.</td>
		</tr>
		<tr>
			<td class="command">console.dirxml(node)</td>
			<td class="desc">- Prints the XML source tree of an HTML or XML element.</td>
		</tr>
		<tr>
			<td class="command">console.log(object[, object, ...])</td>
			<td class="desc">- Writes a message to the console.</td>
		</tr>
		
	</table>	
	
</body>
</html>
